package example07plus;

import example07plus.enity.Ticket;
import example07plus.enity.TicketPoint;

public class Test {
    public static void main(String[] args) {
        TicketPoint ticketPoint1 = new TicketPoint("1号");
        TicketPoint ticketPoint2 = new TicketPoint("2号");
        TicketPoint ticketPoint3 = new TicketPoint("3号");
        new Thread( () -> {
            int size1 = 0;
            while(ticketPoint1.getTicket() != null) {
                //System.out.println("一号售票站售票中");
                size1++;
            }
//            for(Ticket t : ticketPoint1.getTicketList()) {
//                System.out.println("一号售票站卖出" + t.getId() + "号票");
//            }
            System.out.println("一号售票站共卖出" + size1 + "张票");
        }).start();
        new Thread( () -> {
            int size2 = 0;
            while(ticketPoint2.getTicket() != null) {
                //System.out.println("二号售票站售票中");
                size2++;
            }
//            for(Ticket t : ticketPoint2.getTicketList()) {
//                System.out.println("二号售票站卖出" + t.getId() + "号票");
//            }
            System.out.println("二号售票站共卖出" + size2 + "张票");
        }).start();
        new Thread( () -> {
            int size3 = 0;
            while(ticketPoint3.getTicket() != null) {
                //System.out.println("三号售票站售票中");
                size3++;
            }
//            for(Ticket t : ticketPoint3.getTicketList()) {
//                System.out.println("三号售票站卖出" + t.getId() + "号票");
//            }
            System.out.println("三号售票站共卖出" + size3 + "张票");
        }).start();
    }
}